package com.jastar.android.game.richman;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.jastar.android.test.R;
import com.jastar.android.util.Alert;

public class BootSetMoneyActivity extends AppCompatActivity implements View.OnClickListener {

    private int playerCount;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_richman_boot_set_money);

        playerCount = getIntent().getIntExtra(GameActivity.NAME_PLAYER_COUNT, 2);

        super.findViewById(R.id.button_select_1).setOnClickListener(this);
        super.findViewById(R.id.button_select_2).setOnClickListener(this);
        super.findViewById(R.id.button_select_3).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        int money;
        if (v.getId() == R.id.button_select_1) {
            money = 10;
        } else if (v.getId() == R.id.button_select_2) {
            money = 20;
        } else {
            Alert.toast(this, "暂不支持!");
            return;
            //money = 30;
        }
        Intent intent = new Intent(this, GameActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.putExtra(GameActivity.NAME_PLAYER_COUNT, playerCount);
        intent.putExtra(GameActivity.NAME_MONEY, money);
        super.startActivity(intent);
    }
}